package rhinestone.Model;

/**
 * Represents a product.
 * It goes in a ProductContainer, LeaseContainer and a Pack.
 *
 * @author Group 2
 * @version 2010.12.15
 */
public class Product extends Item {
	private int minAmount;
	private int maxAmount;
	private int amountInDIY;
	private int amountInTimberyard;

	/**
	 * Constructor.
	 *
	 * Parameters I think are self-talking.
	 * @param barcode
	 * @param name
	 * @param description
	 * @param price
	 * @param location
	 * @param minAmount
	 * @param maxAmount
	 */
	public Product(String barcode, String name, String description, double price, int amountInDIY, int amountInTimberyard, int minAmount, int maxAmount) {
		super(barcode, name, description, price);
		this.minAmount = minAmount;
		this.maxAmount = maxAmount;
		this.amountInDIY = amountInDIY;
		this.amountInTimberyard = amountInTimberyard;
	}

	/**
	 * Getters and setters.
	 */
	public void setMinAmount(int minAmount) {
		this.minAmount = minAmount;
	}
	public int getMinAmount() {
		return minAmount;
	}

	public void setMaxAmount(int maxAmount) {
		this.maxAmount = maxAmount;
	}
	public int getMaxAmount() {
		return maxAmount;
	}

	public void setAmountInDIY(int amountInDIY) {
		this.amountInDIY = amountInDIY;
	}
	public int getAmountInDIY() {
		return amountInDIY;
	}

	public int getTotalAmount() {
		return (amountInDIY + amountInTimberyard);
	}

	public void setAmountInTimberyard(int amountInTimberyard) {
		this.amountInTimberyard = amountInTimberyard;
	}
	public int getAmountInTimberyard() {
		return amountInTimberyard;
	}

	/**
	 * Object representation for printing.
	 * No need to call it manually, it is called automatically
	 * whenever you put this object in System.out.println();
	 */
	@Override
	public String toString() {
		String output = "Barcode: " + barcode;
		output += "\nName: " + name;
		output += "\nDescription: " + description;
		output += "\nPrice: " + price;
		output += "\nAmount available in DIY: " + amountInDIY;
		output += "\nAmount available in timberyeard: " + amountInTimberyard;
		output += "\nMinimal amount in stock: " + minAmount;
		output += "\nMaximal amount in stock: " + maxAmount;
		return output;
	}
}